﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache" content="no-cache" />
    <title>Ceacas病历打印</title>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/common.js?v=@DateTime.Now.ToString("yyyyMMdd")"></script>
    <script src="~/Scripts/CreateControl.js?v=@DateTime.Now.ToString("yyyyMMdd")" type="text/javascript"></script>
</head>
<body style="height:1500px;">
    <script type="text/javascript">
        CreatePrintViewerEx("100%", "80%", '@Url.Content("~/Grf/Ceacasmr.grf")' + '?id=' + getRnd(), "", true, "<param name=BorderStyle value=1>");
        $(document).ready(function () {
            PrintStart();
        });
        function PrintStart() {
            var pid = "@ViewBag.patientId";
            $.ajax({
                url: "/StrokeCenter/MedicalRecords/GetCEACAS?patientid=" + pid,
                cache: false,
                success: function (data) {
                    var d = $.parseJSON(data);
                    if (d != null) {
                        //打印准备
                        ReportViewer.Stop();
                        var Report = ReportViewer.Report;
                        var Recordset = ReportViewer.Report.DetailGrid.Recordset;
                        //获取标签对象
                        var PATIENT_ID = ReportViewer.Report.FieldByName("PATIENT_ID");
                        var PATIENT_NAME = ReportViewer.Report.FieldByName("PATIENT_NAME");
                        var PATIENT_SEX = ReportViewer.Report.FieldByName("PATIENT_SEX");
                        var PATIENT_AGE = ReportViewer.Report.FieldByName("PATIENT_AGE");
                        var PATIENT_ID = ReportViewer.Report.FieldByName("PATIENT_ID");
                        var PATIENT_PHONE = ReportViewer.Report.FieldByName("PATIENT_PHONE");
                        var Patient_National = ReportViewer.Report.FieldByName("Patient_National");
                        var PATIENT_ID_NUM = ReportViewer.Report.FieldByName("PATIENT_ID_NUM");
                        var PATIENT_ARRIVE_CLASS = ReportViewer.Report.FieldByName("PATIENT_ARRIVE_CLASS");
                        var Patient_Hospital_Num = ReportViewer.Report.FieldByName("Patient_Hospital_Num");
                        var AdmissionTime = ReportViewer.Report.FieldByName("AdmissionTime");
                        var RegisterTime = ReportViewer.Report.FieldByName("RegisterTime");
                        var AdmissionPath = ReportViewer.Report.FieldByName("AdmissionPath");
                        var Patient_Pay_Type = ReportViewer.Report.FieldByName("Patient_Pay_Type");
                        var Assessment_MRS_Score = ReportViewer.Report.FieldByName("Assessment_MRS_Score");
                        var Assessment_Nihss_Score = ReportViewer.Report.FieldByName("Assessment_Nihss_Score");
                        var Assessment_Swallowing_Content = ReportViewer.Report.FieldByName("Assessment_Swallowing_Content");
                        var Assessment_NeckBloodVessel_Type = ReportViewer.Report.FieldByName("Assessment_NeckBloodVessel_Type");
                        var Assessment_NarrowAreaLeft_Type = ReportViewer.Report.FieldByName("Assessment_NarrowAreaLeft_Type");
                        var Assessment_NarrowAreaRight_Type = ReportViewer.Report.FieldByName("Assessment_NarrowAreaRight_Type");
                        var Patient_Height = ReportViewer.Report.FieldByName("Patient_Height");
                        var Patient_Weight = ReportViewer.Report.FieldByName("Patient_Weight");
                        var Patient_BMI = ReportViewer.Report.FieldByName("Patient_BMI");
                        var PATIENT_BLOOD_H = ReportViewer.Report.FieldByName("PATIENT_BLOOD_H");
                        var PATIENT_HEART = ReportViewer.Report.FieldByName("PATIENT_HEART");
                        var Surgery_Start_Time = ReportViewer.Report.FieldByName("Surgery_Start_Time");
                        var Surgery_Symptoms_Bool = ReportViewer.Report.FieldByName("Surgery_Symptoms_Bool");
                        var Surgery_Patch_Bool = ReportViewer.Report.FieldByName("Surgery_Patch_Bool");
                        var Surgery_Location_Type = ReportViewer.Report.FieldByName("Surgery_Location_Type");
                        var Surgery_Anesthesia_Type = ReportViewer.Report.FieldByName("Surgery_Anesthesia_Type");
                        var Surgery_Detection_Type = ReportViewer.Report.FieldByName("Surgery_Detection_Type");
                        var Surgery_Type = ReportViewer.Report.FieldByName("Surgery_Type");
                        var Surgery_Complications_Type = ReportViewer.Report.FieldByName("Surgery_Complications_Type");
                        var Drug_KXXBYW_Bool = ReportViewer.Report.FieldByName("Drug_KXXBYW_Bool");
                        var Drug_KNYW_Bool = ReportViewer.Report.FieldByName("Drug_KNYW_Bool");
                        var Drug_JYYW_Bool = ReportViewer.Report.FieldByName("Drug_JYYW_Bool");
                        var Drug_TZYW_Bool = ReportViewer.Report.FieldByName("Drug_TZYW_Bool");
                        var Drug_TZYW_Type = ReportViewer.Report.FieldByName("Drug_TZYW_Type");
                        var Drug_JTYW_Bool = ReportViewer.Report.FieldByName("Drug_JTYW_Bool");
                        var Drug_JTYW_Type = ReportViewer.Report.FieldByName("Drug_JTYW_Type");
                        var Health_Education_Bool = ReportViewer.Report.FieldByName("Health_Education_Bool");
                        var Health_Education_Type = ReportViewer.Report.FieldByName("Health_Education_Type");
                        var Hospital_Out_Time = ReportViewer.Report.FieldByName("Hospital_Out_Time");
                        var Hospital_Out_Type = ReportViewer.Report.FieldByName("Hospital_Out_Type");
                        var Hospital_MRS_Score = ReportViewer.Report.FieldByName("Hospital_MRS_Score");
                        var Hospital_Nihss_Score = ReportViewer.Report.FieldByName("Hospital_Nihss_Score");
                        var Hospital_Drug_Bool = ReportViewer.Report.FieldByName("Hospital_Drug_Bool");

                        //打印数据模板
                        Report.PrepareLoadData();
                        Recordset.Append();

                        //为标签对象赋值
                        PATIENT_NAME.AsString = IsEmpty(d.patientInfo.PATIENT_NAME) ? "" : d.patientInfo.PATIENT_NAME;
                        PATIENT_SEX.AsString = d.patientInfo.PATIENT_SEX == 1 ? "男" : "女";
                        PATIENT_AGE.AsString = IsEmpty(d.patientInfo.PATIENT_AGE) ? "" : d.patientInfo.PATIENT_AGE;
                        PATIENT_ID.AsString = IsEmpty(d.patientInfo.PATIENT_ID) ? "" : d.patientInfo.PATIENT_ID;
                        PATIENT_PHONE.AsString = IsEmpty(d.patientInfo.PATIENT_PHONE) ? "" : d.patientInfo.PATIENT_PHONE;
                        Patient_National.AsString = IsEmpty(d.patientSigns.Patient_National) ? "" : d.patientSigns.Patient_National;
                        PATIENT_ID_NUM.AsString = IsEmpty(d.patientInfo.PATIENT_ID_NUM) ? "" : d.patientInfo.PATIENT_ID_NUM;
                        PATIENT_ARRIVE_CLASS.AsString = GetArriveClassName(d.patientInfo.PATIENT_ARRIVE_CLASS);
                        Patient_Hospital_Num.AsString = IsEmpty(d.patientSigns.Patient_Hospital_Num) ? "" : d.patientSigns.Patient_Hospital_Num;
                        AdmissionTime.AsString = obj2Timemm(d.ambulanceInfo.AdmissionTime);
                        RegisterTime.AsString = obj2Timemm(d.patientInfo.RegisterTime);
                        AdmissionPath.AsString = GetAdmissionPath(d.ambulanceInfo.AdmissionPath);
                        Patient_Pay_Type.AsString = GetPatient_Pay_Type(d.patientSigns.Patient_Pay_Type);
                        Assessment_MRS_Score.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Assessment_MRS_Score) ? "" : d.patientCasces.Assessment_MRS_Score;
                        Assessment_Nihss_Score.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Assessment_Nihss_Score) ? "" : d.patientCasces.Assessment_Nihss_Score;
                        Assessment_Swallowing_Content.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Assessment_Swallowing_Content) ? "" : d.patientCasces.Assessment_Swallowing_Content;
                        Assessment_NeckBloodVessel_Type.AsString = GetAssessment_NeckBloodVessel_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Assessment_NeckBloodVessel_Type) ? "" : d.patientCasces.Assessment_NeckBloodVessel_Type);
                        Assessment_NarrowAreaLeft_Type.AsString = GetAssessment_NarrowArea_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Assessment_NarrowAreaLeft_Type) ? "" : d.patientCasces.Assessment_NarrowAreaLeft_Type);
                        Assessment_NarrowAreaRight_Type.AsString = GetAssessment_NarrowArea_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Assessment_NarrowAreaRight_Type) ? "" : d.patientCasces.Assessment_NarrowAreaRight_Type);
                        Patient_Height.AsString = IsEmpty(d.patientSigns.Patient_Height) ? "" : d.patientSigns.Patient_Height;
                        Patient_Weight.AsString = IsEmpty(d.patientSigns.Patient_Weight) ? "" : d.patientSigns.Patient_Weight;
                        Patient_BMI.AsString = IsEmpty(d.patientSigns.Patient_BMI) ? "" : d.patientSigns.Patient_BMI;
                        PATIENT_BLOOD_H.AsString = (IsEmpty(d.patientSigns.PATIENT_BLOOD_H) || IsEmpty(d.patientSigns.PATIENT_BLOOD_L)) ? "" : (d.patientSigns.PATIENT_BLOOD_H + "/" + d.patientSigns.PATIENT_BLOOD_L + " mmHg");
                        PATIENT_HEART.AsString = IsEmpty(d.patientSigns.PATIENT_HEART) ? "" : d.patientSigns.PATIENT_HEART;
                        Surgery_Start_Time.AsString = obj2Timemm(d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Start_Time) ? "" : d.patientCasces.Surgery_Start_Time);
                        Surgery_Symptoms_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Symptoms_Bool) || d.patientCasces.Surgery_Symptoms_Bool == "0" ? "无" : "有";
                        Surgery_Patch_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Patch_Bool) || d.patientCasces.Surgery_Patch_Bool == "0" ? "否" : "是";
                        Surgery_Location_Type.AsString = GetSurgery_Location_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Location_Type) ? "" : d.patientCasces.Surgery_Location_Type);
                        Surgery_Anesthesia_Type.AsString = GetSurgery_Anesthesia_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Anesthesia_Type) ? "" : d.patientCasces.Surgery_Anesthesia_Type);
                        Surgery_Detection_Type.AsString = GetSurgery_Detection_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Detection_Type) ? "" : d.patientCasces.Surgery_Detection_Type);
                        Surgery_Type.AsString = GetSurgery_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Type) ? "" : d.patientCasces.Surgery_Type);
                        Surgery_Complications_Type.AsString = GetSurgery_Complications_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Surgery_Complications_Type) ? "" : d.patientCasces.Surgery_Complications_Type);

                        Drug_KXXBYW_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Drug_KXXBYW_Bool) || d.patientCasces.Drug_KXXBYW_Bool == 0 ? "无" : "有";
                        Drug_KNYW_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Drug_KNYW_Bool) || d.patientCasces.Drug_KNYW_Bool == 0 ? "无" : "有";
                        Drug_JYYW_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Drug_JYYW_Bool) || d.patientCasces.Drug_JYYW_Bool == 0 ? "无" : "有";
                        Drug_TZYW_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Drug_TZYW_Bool) || d.patientCasces.Drug_TZYW_Bool == 0 ? "无" : "有";
                        Drug_TZYW_Type.AsString = GetDrug_TZYW_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Drug_TZYW_Type) ? "" : d.patientCasces.Drug_TZYW_Type);
                        Drug_JTYW_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Drug_JTYW_Bool) || d.patientCasces.Drug_JTYW_Bool == 0 ? "无" : "有";
                        Drug_JTYW_Type.AsString = GetDrug_JTYW_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Drug_JTYW_Type) ? "" : d.patientCasces.Drug_JTYW_Type);

                        Health_Education_Bool.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Health_Education_Bool) || d.patientCasces.Health_Education_Bool == 0 ? "无" : "有";
                        Health_Education_Type.AsString = GetHealth_Education_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Health_Education_Type) ? "" : d.patientCasces.Health_Education_Type);
                        Hospital_Out_Time.AsString = obj2Timemm(d.patientCasces == null || IsEmpty(d.patientCasces.Hospital_Out_Time) ? "" : d.patientCasces.Hospital_Out_Time);
                        Hospital_Out_Type.AsString = GetHospital_Out_Type(d.patientCasces == null || IsEmpty(d.patientCasces.Hospital_Out_Type) ? "" : d.patientCasces.Hospital_Out_Type);
                        Hospital_MRS_Score.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Hospital_MRS_Score) ? "" : d.patientCasces.Hospital_MRS_Score;
                        Hospital_Nihss_Score.AsString = d.patientCasces == null || IsEmpty(d.patientCasces.Hospital_Nihss_Score) ? "" : d.patientCasces.Hospital_Nihss_Score;
                        Hospital_Drug_Bool.AsString = GetHospital_Drug_Bool(d.patientCasces == null || IsEmpty(d.patientCasces.Hospital_Drug_Bool) ? "" : d.patientCasces.Hospital_Drug_Bool);


                        //展示打印
                        Recordset.Post();
                        ReportViewer.Start();
                    }
                }
            });
        }
        function GetConsciousness(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "清醒/"; break;
                    case 1: res += "对语言有反应/"; break;
                    case 2: res += "对刺痛有反应/"; break;
                    case 3: res += "对任何刺激无反应/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetArriveClassName(id) {
            if (IsEmpty(id)) return "";
            switch (parseInt(id)) {
                case 0: return "本院急救车";
                case 1: return "当地120";
                case 2: return "外院转院";
                case 3: return "自行来院";
                default: return "";
            }
        }
        function GetAdmissionPath(id) {
            if (IsEmpty(id)) return "";
            switch (parseInt(id)) {
                case 0: return "急诊";
                case 1: return "门诊";
                case 2: return "其他医疗机构转入";
                case 3: return "其他";
                default: return "";
            }
        }
        function GetPatient_Pay_Type(id) {
            if (IsEmpty(id)) return "";
            switch (parseInt(id)) {
                case 0: return "城镇职工基本医疗保险";
                case 1: return "城镇居民基本医疗保险";
                case 2: return "新型农村合作医疗";
                case 3: return "贫困救助";
                case 4: return "商业医疗保险";
                case 5: return "全公费";
                case 6: return "全自费";
                case 7: return "其他社会保险";
                case 8: return "其他";
                default: return "";
            }
        }
        function GetAssessment_NeckBloodVessel_Type(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "颈部血管超声/"; break;
                    case 1: res += "CTA/"; break;
                    case 2: res += "MRA/"; break;
                    case 3: res += "DSA/"; break;
                    case 4: res += "未查/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetAssessment_NarrowArea_Type(id) {
            if (IsEmpty(id)) return "";
            switch (parseInt(id)) {
                case 0: return "颈总";
                case 1: return "球部";
                case 2: return "颈内";
                case 3: return "锁骨下动脉";
                case 4: return "椎动脉";
                case 5: return "无";
                default: return ""
            }
        }
        function GetSurgery_Location_Type(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "LIA/"; break;
                    case 1: res += "RICA/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetSurgery_Anesthesia_Type(id) {
            if (IsEmpty(id)) return "";
            switch (parseInt(id)) {
                case 0: return "全麻";
                case 1: return "局麻";
                default: return "";
            }
        }
        function GetSurgery_Detection_Type(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "TCD/"; break;
                    case 1: res += "脑电图/"; break;
                    case 2: res += "其他/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetSurgery_Type(id) {
            if (IsEmpty(id)) return "";
            switch (parseInt(id)) {
                case 0: return "标准式CEA";
                case 1: return "外翻式CEA";
                case 2: return "标准式CEA";
                case 3: return "CAS";
                case 4: return "复合手术";
                default: return "";
            }
        }
        function GetSurgery_Complications_Type(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "脑梗死/"; break;
                    case 1: res += "高灌注/"; break;
                    case 2: res += "脑出血/"; break;
                    case 3: res += "周围神经损伤/"; break;
                    case 4: res += "切口感染/"; break;
                    case 5: res += "继发性癫痫/"; break;
                    case 6: res += "肺部感染/"; break;
                    case 7: res += "泌尿系感染/"; break;
                    case 8: res += "其他/"; break;
                    case 9: res += "无/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetDrug_TZYW_Type(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "他汀类/"; break;
                    case 1: res += "盐酸及其衍生物/"; break;
                    case 2: res += "贝特类/"; break;
                    case 3: res += "胆固醇吸收抑制器/"; break;
                    case 4: res += "其他/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetDrug_JTYW_Type(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "胰岛素/"; break;
                    case 1: res += "磺酰脲类/"; break;
                    case 2: res += "双胍类/"; break;
                    case 3: res += "a糖苷酶抑制剂/"; break;
                    case 4: res += "胰岛素增敏剂/"; break;
                    case 5: res += "非磺酰脲类促胰岛分泌剂/"; break;
                    case 6: res += "其他/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetHealth_Education_Type(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "集体病区教育/"; break;
                    case 1: res += "一对一教育/"; break;
                    case 2: res += "其他/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
        function GetHospital_Out_Type(id) {
            if (IsEmpty(id)) return "";
            switch (parseInt(id)) {
                case 0: return "医嘱离院";
                case 1: return "医嘱转院";
                case 2: return "医嘱转社区服务机构/乡镇卫生院";
                case 3: return "非医嘱离院";
                case 4: return "死亡";
                case 5: return "其他";
                default: return "";
            }
        }

        function GetHospital_Drug_Bool(ids) {
            if (IsEmpty(ids)) return "";
            var idArray = ids.split(',');
            var res = "";
            for (var i = 0; i < idArray.length; i++) {
                switch (parseInt(idArray[i])) {
                    case 0: res += "降压药/"; break;
                    case 1: res += "降糖药/"; break;
                    case 2: res += "调脂药/"; break;
                    case 3: res += "抗凝药/"; break;
                    case 4: res += "抗血小板药/"; break;
                    case 5: res += "中药治疗/"; break;
                    case 6: res += "其他/"; break;
                    case 7: res += "无/"; break;
                    default: break;
                }
            }
            if (res.length > 0)
                res = res.substring(0, res.length - 1);
            return res;
        }
    </script>
</body>
</html>